export function priceFormat(parm, n = 3) {
  //数字加逗号(去掉尾部多余的0)
  parm = Number(parm || 0).toString(); //使用Number强转一下再toString
  let integer = ``,
    isNegativeNumber = false,
    decimal = ``,
    result = ``;
  isNegativeNumber = parm / 1 > 0 ? false : true;
  parm = parm.replace('-', '');
  integer = parm.split(`.`)[0];
  if (parm.split(`.`).length > 1) {
    decimal = parm.split(`.`)[1];
  }
  while (integer.length > 3) {
    result = `,${integer.slice(-n)}${result}`;
    integer = integer.slice(0, integer.length - 3);
  }
  if (integer) {
    result = decimal ? `${integer}${result}.${decimal}` : `${integer}${result}.0000`;
  }

  if (isNegativeNumber && parm / 1 != 0) {
    result = `-${result}`;
  }

  return result;
}
